home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / langs / gfaxpert.lzh / GFAXPERT.LIB / SOUND.LST < prev    next >
Encoding:
File List  |  1986-10-19  |  11.1 KB  |  484 lines

  1. ' *****************
  2. ' *** SOUND.LST ***
  3. ' *****************
  4. '
  5. DEFWRD "a-z"
  6. '
  7. > PROCEDURE beep(number)
  8.   LOCAL i
  9.   FOR i=1 TO number
  10.     PRINT CHR$(7);
  11.     PAUSE 10
  12.   NEXT i
  13. RETURN
  14. ' **********
  15. '
  16. > PROCEDURE alarm.sound
  17.   ' *** ta-ti-ta sound (warning)
  18.   SOUND 1,10,12,4,25
  19.   SOUND 1,10,6,4,25
  20.   SOUND 1,10,12,4,50
  21.   SOUND 1,0
  22. RETURN
  23. ' **********
  24. '
  25. > PROCEDURE siren1.sound(number)
  26.   ' *** siren (length determined by number)
  27.   LOCAL n,i
  28.   FOR n=1 TO number
  29.     FOR i=1 TO 8
  30.       SOUND 1,15,i,4,1
  31.     NEXT i
  32.     PAUSE 5
  33.     FOR i=1 TO 8
  34.       SOUND 1,15,i,4,1
  35.     NEXT i
  36.     PAUSE 5
  37.   NEXT n
  38.   WAVE 0,0
  39. RETURN
  40. ' **********
  41. '
  42. > PROCEDURE tideli.sound
  43.   SOUND 0,15,2,3,5
  44.   SOUND 0,15,2,4,5
  45.   SOUND 0,15,2,3,5
  46.   SOUND 0,15,2,5,5
  47.   SOUND 0,15,2,3,5
  48.   SOUND 0,15,2,6,10
  49.   SOUND 0,0
  50. RETURN
  51. ' **********
  52. '
  53. > PROCEDURE bounce1.sound(pause)
  54.   LOCAL n
  55.   FOR n=15 DOWNTO 0
  56.     SOUND 1,n,5,1
  57.     SOUND 2,n,12,2
  58.     SOUND 3,n,5,4
  59.     WAVE 7
  60.     PAUSE pause
  61.     SOUND 3,n,5,5
  62.     PAUSE pause
  63.   NEXT n
  64.   WAVE 0,0
  65. RETURN
  66. ' **********
  67. '
  68. > PROCEDURE bounce2.sound(pause)
  69.   LOCAL n
  70.   FOR n=15 DOWNTO 0
  71.     SOUND 1,n,1,3
  72.     SOUND 2,n,5,3
  73.     SOUND 3,n,1,4
  74.     WAVE 7
  75.     PAUSE pause
  76.     SOUND 3,n,1,5
  77.     PAUSE pause
  78.   NEXT n
  79.   WAVE 0,0
  80. RETURN
  81. ' **********
  82. '
  83. > PROCEDURE tong.sound
  84.   SOUND 1,10,1,5
  85.   WAVE 1,1,3,6000,10
  86. RETURN
  87. ' **********
  88. '
  89. > PROCEDURE poof.sound
  90.   WAVE 56,7,0,20000,0
  91. RETURN
  92. ' **********
  93. '
  94. > PROCEDURE clang.sound
  95.   SOUND 1,14,1,5
  96.   SOUND 2,14,5,7
  97.   SOUND 3,14,8,6
  98.   WAVE 7,7,9,17391
  99. RETURN
  100. ' **********
  101. '
  102. > PROCEDURE heartbeat.sound
  103.   SOUND 1,9,1,4
  104.   SOUND 2,7,1,4
  105.   SOUND 3,10,1,1
  106.   WAVE 7739,3,8,4964
  107. RETURN
  108. ' **********
  109. '
  110. > PROCEDURE ting.sound
  111.   SOUND 1,15,10,6
  112.   SOUND 2,0,1,1
  113.   SOUND 3,0,12,1
  114.   WAVE 1,1,9,12085
  115. RETURN
  116. ' **********
  117. '
  118. > PROCEDURE pompom.sound
  119.   ' *** play Pompom-tune (XBIOS 32 format)
  120.   '
  121.   ' *** load POMPOM.INL (384 bytes) here
  122.   INLINE pompom.snd%,384
  123.   '
  124.   ~XBIOS(32,L:pompom.snd%)
  125.   PAUSE 400
  126.   WAVE 0,0
  127. RETURN
  128. ' **********
  129. '
  130. > PROCEDURE initio.sound
  131.   ' *** put sound-data in string (XBIOS 32 format)
  132.   ' *** commands in DATA-lines :
  133.   ' ***         REG = 14 parameters for registers 0-13
  134.   ' ***         END = end of sound-string
  135.   ' ***         PAUSE = pause (followed by time in 1/50 seconds)
  136.   ' ***         VAR = decrease/increase tone : channel,start,+/-step,end-value
  137.   ' *** 'WAVE 0,0' terminates all sounds
  138.   ' *** if Keyclick is on, any keypress will terminate sound
  139.   ' *** uses Procedure Sound.string
  140.   ' *** use soundstring : @do.sound(sound$)
  141.   '
  142.   bounce3.sound:
  143.   DATA REG,0,0,0,0,0,0,27,248,16,16,16,35,95,0
  144.   DATA VAR,3,255,-1,116
  145.   DATA PAUSE,255,END
  146.   RESTORE bounce3.sound
  147.   @sound.string(bounce3$)
  148.   '
  149.   bounce4.sound:
  150.   DATA REG,0,216,4,219,5,0,0,254,16,0,0,223,118,0
  151.   DATA VAR,0,0,22,0,END
  152.   RESTORE bounce4.sound
  153.   @sound.string(bounce4$)
  154.   '
  155.   bounce5.sound:
  156.   DATA REG,82,2,251,13,34,0,0,248,16,0,0,0,86,0
  157.   DATA VAR,0,0,11,0,END
  158.   RESTORE bounce5.sound
  159.   @sound.string(bounce5$)
  160.   '
  161.   bounce6.sound:
  162.   DATA REG,0,0,0,0,0,0,0,252,16,0,0,20,70,0
  163.   DATA VAR,1,0,1,255,END
  164.   RESTORE bounce6.sound
  165.   @sound.string(bounce6$)
  166.   '
  167.   tingeling.sound:
  168.   DATA REG,0,0,0,0,0,0,23,248,16,16,16,130,62,0
  169.   DATA VAR,0,255,-106,116
  170.   DATA PAUSE,255,END
  171.   RESTORE tingeling.sound
  172.   @sound.string(tingeling$)
  173.   '
  174.   tingeling2.sound:
  175.   DATA REG,0,0,0,0,0,0,0,254,16,0,0,207,88,0
  176.   DATA VAR,0,0,41,0,END
  177.   RESTORE tingeling2.sound
  178.   @sound.string(tingeling2$)
  179.   '
  180.   siren2.sound:
  181.   DATA REG,0,1,0,0,0,0,0,8,15,0,0,0,0,0,0,10
  182.   DATA VAR,0,1,10,0,END
  183.   RESTORE siren2.sound
  184.   @sound.string(siren2$)
  185.   '
  186.   chopper.sound:
  187.   DATA REG,176,0,238,1,119,12,26,227,16,11,14,111,2,12,END
  188.   RESTORE chopper.sound
  189.   @sound.string(chopper$)
  190.   '
  191.   surf.sound:
  192.   DATA REG,0,0,0,0,0,0,31,199,16,16,16,0,32,14,END
  193.   RESTORE surf.sound
  194.   @sound.string(surf$)
  195.   '
  196.   ting2.sound:
  197.   DATA REG,200,0,201,0,100,0,0,248,16,16,16,0,20,0,END
  198.   RESTORE ting2.sound
  199.   @sound.string(ting2$)
  200.   '
  201.   ding.sound:
  202.   DATA REG,64,1,56,1,0,0,0,252,16,16,0,20,20,0,END
  203.   RESTORE ding.sound
  204.   @sound.string(ding$)
  205.   '
  206.   ploink.sound:
  207.   DATA REG,2,15,2,15,0,0,0,252,16,16,0,20,20,10
  208.   DATA VAR,1,240,-16,0
  209.   DATA PAUSE,10
  210.   DATA REG,2,15,2,15,0,0,0,252,0,0,0,20,20,10,END
  211.   RESTORE ploink.sound
  212.   @sound.string(ploink$)
  213.   '
  214.   toing.sound:
  215.   DATA REG,140,1,216,4,219,5,0,254,16,0,0,207,88,0
  216.   DATA VAR 0,0,41,0,END
  217.   RESTORE toing.sound
  218.   @sound.string(toing$)
  219.   '
  220.   bell.sound:
  221.   DATA REG,64,0,120,0,0,0,0,252,16,16,0,20,20,0,END
  222.   RESTORE bell.sound
  223.   @sound.string(bell$)
  224.   '
  225.   gong.sound:
  226.   DATA REG,1,5,0,5,2,5,0,248,16,16,16,0,20,1,END
  227.   RESTORE gong.sound
  228.   @sound.string(gong$)
  229.   '
  230.   gong2.sound:
  231.   DATA REG,210,3,232,3,209,7,0,248,16,16,16,111,163,0,END
  232.   RESTORE gong2.sound
  233.   @sound.string(gong2$)
  234.   '
  235.   gong3.sound:
  236.   DATA REG,0,13,0,12,0,15,0,248,16,16,16,200,200,2
  237.   DATA PAUSE,250,END
  238.   RESTORE gong3.sound
  239.   @sound.string(gong3$)
  240.   '
  241.   dingdong.sound:
  242.   DATA REG,65,1,64,1,66,1,0,248,16,16,16,255,70,1
  243.   DATA PAUSE,40
  244.   DATA REG,65,1,242,0,127,1,0,248,16,16,16,255,100,1,END
  245.   RESTORE dingdong.sound
  246.   @sound.string(dingdong$)
  247.   '
  248.   pieuw.sound:
  249.   DATA REG,1,0,0,0,0,0,0,254,16,0,0,0,35,1
  250.   DATA VAR,0,50,1,100,END
  251.   RESTORE pieuw.sound
  252.   @sound.string(pieuw$)
  253.   '
  254.   poing.sound:
  255.   DATA REG,1,0,0,0,0,0,0,254,16,0,0,0,35,1
  256.   DATA VAR,0,100,-1,50,END
  257.   RESTORE poing.sound
  258.   @sound.string(poing$)
  259.   '
  260.   zap.sound:
  261.   DATA REG,0,16,0,0,0,0,0,252,15,0,0,20,0,4
  262.   DATA VAR,1,0,1,15
  263.   DATA PAUSE,1
  264.   DATA REG,0,16,0,0,0,0,0,252,0,0,0,20,0,4,END
  265.   RESTORE zap.sound
  266.   @sound.string(zap$)
  267.   '
  268.   dlink.sound:
  269.   DATA REG,8,2,12,4,0,0,0,252,16,16,0,20,20,9
  270.   DATA VAR,0,200,-20,0
  271.   DATA PAUSE,1
  272.   DATA REG,8,2,12,4,0,0,0,252,0,0,0,20,20,9,END
  273.   RESTORE dlink.sound
  274.   @sound.string(dlink$)
  275.   '
  276.   shot.sound:
  277.   DATA REG,0,0,0,0,0,0,15,199,16,16,16,0,16,0
  278.   DATA PAUSE,25
  279.   DATA REG,0,0,0,0,0,0,15,199,0,0,0,0,16,0,END
  280.   RESTORE shot.sound
  281.   @sound.string(shot$)
  282.   '
  283.   explosion1.sound:
  284.   DATA REG,0,0,0,0,0,0,31,199,16,16,16,0,50,9,END
  285.   RESTORE explosion1.sound
  286.   @sound.string(explosion1$)
  287.   '
  288.   explosion2.sound:
  289.   DATA REG,0,0,100,0,200,0,31,198,16,16,16,207,88,0
  290.   DATA VAR,6,255,0,0,END
  291.   RESTORE explosion2.sound
  292.   @sound.string(explosion2$)
  293.   '
  294.   laser.sound:
  295.   DATA REG,100,0,200,0,50,0,31,220,16,0,16,127,37,0
  296.   DATA VAR,0,0,137,200
  297.   DATA PAUSE,128,END
  298.   RESTORE laser.sound
  299.   @sound.string(laser$)
  300.   '
  301.   fft.sound:
  302.   DATA REG,42,2,88,4,164,8,0,199,16,16,16,106,10,4
  303.   DATA VAR 4,124,54,164,END
  304.   RESTORE fft.sound
  305.   @sound.string(fft$)
  306.   '
  307.   steam.sound:
  308.   DATA REG,0,0,0,0,0,0,10,199,16,16,16,0,80,0
  309.   DATA PAUSE,20
  310.   DATA REG,0,0,0,0,0,0,10,255,0,0,0,0,80,100,END
  311.   RESTORE steam.sound
  312.   @sound.string(steam$)
  313.   '
  314.   thrill.sound:
  315.   DATA REG,86,0,86,0,0,0,0,252,16,15,0,50,1,10
  316.   DATA VAR,9,16,-1,0
  317.   DATA PAUSE,0
  318.   DATA REG,86,0,86,0,0,0,0,252,0,15,0,50,1,10,END
  319.   RESTORE thrill.sound
  320.   @sound.string(thrill$)
  321.   '
  322.   jingle.sound:
  323.   DATA REG,100,4,101,4,0,0,0,252,15,15,0,0,30,0
  324.   DATA PAUSE,5
  325.   DATA REG,100,3,101,3,0,0,0,252,15,15,0,0,30,0
  326.   DATA PAUSE,5
  327.   DATA REG,100,2,101,2,0,0,0,252,15,15,0,0,30,0
  328.   DATA PAUSE,5
  329.   DATA REG,100,1,101,1,0,0,0,252,15,15,0,0,30,0
  330.   DATA PAUSE,5
  331.   DATA REG,100,0,101,0,0,0,0,252,16,16,0,0,30,0,END
  332.   RESTORE jingle.sound
  333.   @sound.string(jingle$)
  334.   '
  335. RETURN
  336. ' ***
  337. > PROCEDURE sound.string(VAR s$)
  338.   LOCAL n,snd$,snd,channel,begin,step,end
  339.   s$=""
  340.   DO
  341.     READ snd$
  342.     snd$=UPPER$(snd$)
  343.     EXIT IF snd$="END"
  344.     IF snd$="REG"
  345.       FOR n=0 TO 13
  346.         READ snd
  347.         s$=s$+CHR$(n)+CHR$(snd)
  348.       NEXT n
  349.     ENDIF
  350.     IF snd$="PAUSE"
  351.       READ snd
  352.       s$=s$+CHR$(130)+CHR$(snd)
  353.     ENDIF
  354.     IF snd$="VAR"
  355.       READ channel,begin,step,end
  356.       s$=s$+CHR$(128)+CHR$(begin)+CHR$(129)+CHR$(channel)+CHR$(step)
  357.       s$=s$+CHR$(end)
  358.     ENDIF
  359.   LOOP
  360.   s$=s$+CHR$(255)+CHR$(0)               ! terminator
  361. RETURN
  362. ' ***
  363. > PROCEDURE do.sound(sound$)
  364.   VOID XBIOS(32,L:VARPTR(sound$))
  365. RETURN
  366. ' **********
  367. '
  368. > PROCEDURE initio.speech
  369.   ' *** uses STSPEECH.TOS to speak
  370.   ' *** RESERVE doesn't function, therefore reset necessary
  371.   ' *** don't be surprised by a sudden freeze or some bombs
  372.   ' *** routine by Dave Morrison
  373.   ' *** uses Standard Procedure
  374.   LOCAL i%,k%,bpage%,prg%,phoneme$,speech$,m$
  375.   file$="I:\HIGH_MED\SOUND\STSPEECH.TOS"                ! or other path
  376.   IF NOT EXIST(file$)
  377.     ALERT 3,"Can't find| |STSPEECH.TOS|",1,"EXIT",button
  378.     @exit
  379.   ENDIF
  380.   RESERVE FRE(0)-29000
  381.   bpage%=EXEC(3,file$,"","")
  382.   IF bpage%>0
  383.     prg%=bpage%+&H100
  384.     POKE prg%+&HE,&H4E
  385.     POKE prg%+&HF,&H75
  386.     POKE prg%+&H6C,&H4E
  387.     POKE prg%+&H6D,&H75
  388.     speech_buf%=prg%+&H6EEE
  389.     POKE speech_buf%,&HFE
  390.     phoneme%=prg%+&H32
  391.     speech%=prg%+&H88
  392.     RESTORE speech_data
  393.     FOR i%=1 TO 6
  394.       READ k%
  395.       phoneme$=phoneme$+CHR$(k%)
  396.       speech$=speech$+CHR$(k%)
  397.     NEXT i%
  398.     phoneme$=phoneme$+MKL$(phenome%)
  399.     speech$=speech$+MKL$(speech%)
  400.     FOR i%=1 TO 6
  401.       READ k%
  402.       phoneme$=phoneme$+CHR$(k%)
  403.       speech$=speech$+CHR$(k%)
  404.     NEXT i%
  405.     phoneme%=VARPTR(phoneme$)
  406.     speech%=VARPTR(speech$)
  407.   ELSE
  408.     m$="*** ERROR ***| |EXEC 3 returns|    "+STR$(bpage%)
  409.     ALERT 3,m$,1,"EXIT",k
  410.     @exit
  411.   ENDIF
  412.   '
  413.   speech_data:
  414.   DATA &h48,&he7,&hff,&hfe,&h4e,&hb9,&h4c,&hdf,&h7f,&hff,&h4e,&h75
  415. RETURN
  416. ' ***
  417. > PROCEDURE talk(txt$)
  418.   ' *** use phonetic spelling to improve pronunciation
  419.   POKE speech_buf%+1,LEN(txt$)
  420.   txt$=txt$+CHR$(0)
  421.   BMOVE VARPTR(txt$),speech_buf%+2,LEN(txt$)
  422.   CALL phoneme%
  423.   CALL speech%
  424.   PAUSE 5
  425. RETURN
  426. ' **********
  427. '
  428. > PROCEDURE load.sample(file$,VAR sample|())
  429.   ' *** load sample in byte-array
  430.   LOCAL m$,length%,sample%
  431.   IF EXIST(file$)
  432.     OPEN "I",#90,file$
  433.     length%=LOF(#90)
  434.     CLOSE #90
  435.     ERASE sample|()
  436.     DIM sample|(length%-1)
  437.     sample%=V:sample|(0)
  438.     BLOAD file$,sample%
  439.   ELSE
  440.     m$="Can't find|sample-file|"+file$+"|   !!??"
  441.     ALERT 3,m$,1,"EDIT",k
  442.     EDIT
  443.   ENDIF
  444. RETURN
  445. ' ***
  446. > PROCEDURE play.sample(speed%,VAR sample|())
  447.   ' *** play sample (loaded with Procedure Load.sample)
  448.   ' *** try speed% 0-10
  449.   LOCAL bascode%,length%,start%
  450.   '
  451.   ' *** load BASCODE.INL (2794 bytes) here (= BASCODE.EXE from program Replay)
  452.   ' *** don't worry about the message 'End of file reached' after loading
  453.   INLINE bascode%,8000
  454.   '
  455.   length%=DIM?(sample|())
  456.   adres%=V:sample|(0)
  457.   start%=bascode%+28
  458.   LONG{start%+2}=adres%
  459.   LONG{start%+6}=length%
  460.   LONG{start%+10}=speed%
  461.   CALL start%
  462. RETURN
  463. ' **********
  464. '
  465. > PROCEDURE sample
  466.   ' *** play sample (a short after this Procedure PAUSE may be necessary)
  467.   LOCAL bascode%,sample%,start%
  468.   '
  469.   ' *** load BASCODE.INL (2794 bytes) here (= BASCODE.EXE from program Replay)
  470.   ' *** don't worry about the message 'end of file reached' after loading
  471.   INLINE bascode%,8000
  472.   '
  473.   ' *** load sample here (change length, max. 32746 bytes)
  474.   INLINE sample%,10000
  475.   '
  476.   start%=bascode%+28
  477.   LONG{start%+2}=sample%
  478.   LONG{start%+6}=10000          ! change length here as well
  479.   LONG{start%+10}=2             ! try speed 0-10 for best effect
  480.   CALL start%
  481. RETURN
  482. ' **********
  483. '
  484.